1. Field of the Invention
The present invention relates to a method, a computer program and a computer system for assisting in analyzing a program.
2. Description of Related Art
As program size has increased, a desire for further performance improvement of a program has arisen. To analyze the performance of a program, developers use a method of visually examining frequently executed methods. However, due to the increase in size of recent programs, it is often the case that programs include no exceptionally frequently used method. In addition, one of the problems of the analysis method is that a developer examines a program on a method-by-method basis.
In this regard, there are methods of performing an optimization analysis by collecting similar codes of a program. Similarity of program execution characteristics is determined in one method of analyzing similar codes of a program. The program execution characteristics are, for example, CPI (Cycles Per Instruction), the number of instructions, and branch characteristics.
Another method is based on source code characteristics. The source code characteristics are, for example, the number of lines, the number of variables and the number of operators.
An example of the method based on source code characteristics is a method of dividing source code into tokens, converting user-defined names and constants into certain symbols, and then detecting matching parts. A typical example of such a method is CCFinder.
In CCFinder, source code is judged on a token-by-token basis, and this makes it possible to handle a difference in parameters such as name and constant value. See Toshihiro Kamiya, “Identifier Variation Analysis Using Code Clone as Template”, May 30, 2008, National Institute of Advanced Industrial Science and Technology.
However, CCFinder cannot handle a difference in logics. For example, in CCFinder, if a program written using for loop statements is rewritten using while loop statements, the two programs are treated as different logics.
When a developer analyzes the performance of a program, expected effects are not always obtained by performing the analysis on a method-by-method basis. Such being the case, desired has been a method which enables detection of similar logics based on a context of the program.